import logging
import sys
import time

sys.path.append('.')

import stomppy.stomp as stomp

LOG_FORMAT = "%(asctime)s - %(levelname)s: %(message)s"
logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT)

client = stomp.StompClient('ws://127.0.0.1:8080/stomp')
client.connect()
time.sleep(2)
client.subscribe('user/broker_name/zzz', lambda x: print('sub msg: ' + x.body))
time.sleep(4)
client.send('app/hello', body='AAAA')
client.send('app/hello', body='BBBB')
time.sleep(5)
client.disconnect()